import 'constant.dart';

/// A DTO for steps taken containing a detected step and its corresponding
/// status, i.e. walking, stopped or unknown.
class PedestrianStatus {
  static const _WALKING = 'walking';
  static const _STOPPED = 'stopped';
  static const _UNKNOWN = 'unknown';

  static const Map<int, String> _STATUSES = {
    Constant.stopped: _STOPPED,
    Constant.walking: _WALKING
  };

  late DateTime _timeStamp;
  String _status = _UNKNOWN;

  PedestrianStatus._(dynamic t) {
    int _type = t as int;
    _status = _STATUSES[_type]!;
    _timeStamp = DateTime.now();
  }

  PedestrianStatus.fromEvent(dynamic t) {
    int _type = t as int;
    _status = _STATUSES[_type]!;
    _timeStamp = DateTime.now();
  }

  String get status => _status;

  DateTime get timeStamp => _timeStamp;

  @override
  String toString() => 'Status: $_status at ${_timeStamp.toIso8601String()}';
}
